using System;

namespace OperatorOverloadingExample // 命名空间
{
    // 定义一个简单的类，表示二维坐标点
    public class Point
    {
        public int X { get; set; }
        public int Y { get; set; }

        public Point(int x, int y)
        {
            X = x;
            Y = y;
        }

        // 重载加法运算符
        public static Point operator +(Point p1, Point p2)
        {
            return new Point(p1.X + p2.X, p1.Y + p2.Y);
        }

        // 重载 ToString 方法，方便输出
        public override string ToString()
        {
            return $"({X}, {Y})";
        }
    }

    public class Program
    {
        public static void Main(string[] args)
        {
            Point point1 = new Point(2, 3);
            Point point2 = new Point(5, 7);

            // 使用重载的加法运算符
            Point result = point1 + point2;

            Console.WriteLine($"Point 1: {point1}"); // 输出: Point 1: (2, 3)
            Console.WriteLine($"Point 2: {point2}"); // 输出: Point 2: (5, 7)
            Console.WriteLine($"Result of Addition: {result}"); // 输出: Result of Addition: (7, 10)
        }
    }
}
